<?php
namespace Admin\Controller;

class BloodController extends CommonController{
    
    public function chart(){
        $list = array();$listx = array();$listyLow = array();$listyHigh = array();
        $firstDate = date('Y-m-d',strtotime("-".(date('j')-1)." day"));//本月1号日期
        $start_date = I('get.start_date') ? I('get.start_date') : $firstDate;
        $end_date = I('get.end_date') ? I('get.end_date') : date('Y-m-d');
        
        $where = array('uid'=>I('get.uid'),'create_date'=>array('BETWEEN',array($start_date,$end_date)));
        $list = D($this->controller)->where($where)->order('id asc')->select();
        //生成图表纵横轴数据
        foreach($list as $v){
            $listx[] = substr($v['create_date'],5,5);
            $listyLow[] = $v['low'];
            $listyHigh[] = $v['high'];
        }
        
        $this->assign('xStr',"'".implode("','",$listx)."'");
        $this->assign('yStrLow',implode(",",$listyLow));
        $this->assign('yStrHigh',implode(",",$listyHigh));
        $this->assign('start_date',$start_date);
        $this->assign('end_date',$end_date);
        $this->display();
    }
    
}